Home:ALL Converter>Python svgwrite and simultaneous animationTransforms

Python svgwrite and simultaneous animationTransforms

Ask Time:2020-12-30T06:35:56         Author:Emil

Json Formatter

I am trying to use python svgwrite to make an object scale and rotate at the same time. My efforts has so far been to add two consecutive "animateTransform". It does however seem to only take the last action into account, as seen in my example.

import svgwrite 

path = [(100,100),(100,200),(200,200),(200,100)]

image = svgwrite.Drawing('test.svg',size=(300,300))

rectangle = image.add(image.polygon(path,id ='polygon',stroke="black",fill="white"))
rectangle.add(image.animateTransform("rotate","transform",id="polygon", from_="0 150 150", to="360 150 150",dur="4s",begin="0s",repeatCount="indefinite"))
rectangle.add(image.animateTransform("scale","transform",id="polygon", from_="0", to="1",dur="4s",begin="0s",repeatCount="indefinite"))

image.save()
display(SVG('test.svg'))

Can anyone help?

Author:Emil,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/65499685/python-svgwrite-and-simultaneous-animationtransforms
yy